import api from './index'

// 获取财务记录列表
export const getFinancialRecords = (params?: { page?: number; page_size?: number }) => {
  return api.get('/finance/record', { params })
}

// 根据用户ID获取财务记录列表
export const getFinancialRecordsByUserId = (id: number, params?: { page?: number; page_size?: number }) => {
  return api.get(`/finance/record/user/${id}`, { params })
}

// 获取财务记录详情
export const getFinancialRecordById = (id: number) => {
  return api.get(`/finance/record/${id}`)
}

// 创建财务记录
export const createFinancialRecord = (data: any) => {
  return api.post('/finance/record', data)
}

// 更新财务记录
export const updateFinancialRecord = (id: number, data: any) => {
  return api.put(`/finance/record/${id}`, data)
}

// 删除财务记录
export const deleteFinancialRecord = (id: number) => {
  return api.delete(`/finance/record/${id}`)
}